package Expe15;

import java.io.*;

public class T4 {
    public static void main(String[] args)  {
        //T3.txt 按行输出，并添加行号，写入T4.txt
        try {
            FileReader from = new FileReader("D:\\Git\\gitCode\\java-journal\\Expe15\\T3.txt");
            BufferedReader in = new BufferedReader(from);

            FileWriter to = new FileWriter("D:\\Git\\gitCode\\java-journal\\Expe15\\T4.txt");
            BufferedWriter out = new BufferedWriter(to);
            String s = null;
            int i = 0;
            while ((s=in.readLine()) != null) {
                i++;
                out.write(i+" " + s);
                out.newLine();
            }
            out.flush();
            from.close();
            to.close();
        }catch (IOException e){
            System.out.println(e);
        }
    }
}
